﻿using M_Process.API.Appliction.Command.ProcessRouteCommand;
using M_Process.Domain;
using M_Process.Repository.ProcessInterface;
using MediatR;

namespace M_Process.API.Appliction.CommandHandlers.ProcessRouteHandler
{
    /// <summary>
    /// 反填工序信息
    /// </summary>
    public class ReverseGetByidProcessTasksCommandHandeler : IRequestHandler<ReverseGetByidProcessTasksCommand, ProductionProcess>
    {
        /// <summary>
        /// 工序任务仓储接口
        /// </summary>
        protected readonly IProductionProcessRepository _processTasksRepository;
        public ReverseGetByidProcessTasksCommandHandeler(IProductionProcessRepository processTasksRepository)
        {
            _processTasksRepository = processTasksRepository;
        }

        public async Task<ProductionProcess> Handle(ReverseGetByidProcessTasksCommand request, CancellationToken cancellationToken)
        {
            return await _processTasksRepository.GetModelsAsync(request.ProductionProcessesId);
        }
    }
}
